package edu.sctu.practice.class01.wulixia.month09_wlx.assign03.two;

/**
 * Created by wulixia on 2015/11/4.
 */
public class Cylinder extends Circle{
    private double length;

    public Cylinder() {
        super();
        length = 1.0;
    }

    public Cylinder(double r, double l) {
        super(r);
        length = l;
    }

    public double getLength() {
        return length;
    }

    public void setLength(double length) {
        this.length = length;
    }

    public double findArea() {
        return 2 * super.findArea() + (2 * getRadius() * Math.PI) * length;
    }

    public double findVolume() {
        return super.findArea() * length;
    }

    public boolean equals(Cylinder cylinder) {
        return (this.radius == cylinder.getRadius()) && (this.length == cylinder.getLength());
    }

    public String toString() {
        return "圆柱的半径 = " + radius + " ，圆柱的长= " + length;
    }

}
